php copy image from one folder to another

115

php copy image from one folder to another -

<?php
$imagePath = "/var/www/projectName/Images/somepic.jpg";
$newPath = "/test/Uploads/";
$ext = '.jpg';
$newName  = $newPath."a".$ext;

$copied = copy($imagePath , $newName);

if ((!$copied)) 
{
    echo "Error : Not Copied";
}
else
{ 
    echo "Copied Successful";
}
?>

Comments

Submit
0 Comments